﻿<?php
/**
 * 
 * Enter description here ...
 * @param unknown_type $var
 * @param unknown_type $doNotUseIsEmpty
 */
function has_value(&$var, $doNotUseIsEmpty = false)
{
	if(is_null($var)){
		return false;
	} else if(!$doNotUseIsEmpty && empty($var)){
		return false;
	}
	return true;
}

/**
 * 
 * Enter description here ...
 * @param unknown_type $message
 * @param unknown_type $function
 */
function alert($message, $function = null)
{
	echo "<html>";
	echo "<script type='text/javascript' language='Javascript'>\n";
	echo "alert('".trim($message)."');";
	echo "</script>";
	echo "</html>";
}

/**
 * 
 * Enter description here ...
 * @param unknown_type $var
 * @param unknown_type $useVarDump
 */
function debug($var, $useVarDump = false)
{
	if(!has_value($var)){
		if(is_array($var)){
			$var = "[Empty array]";
		} else if(is_string($var)){
			$var = "[Empty string]";
		} else {
			$var = "[Empty object]";
		}
	}
	echo '<pre>';
	if($useVarDump){
		var_dump($var);
	} else {
		print_r($var);
	}
	echo '</pre>';
}

?>